home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
Inspectors
/
InspectMe
/
ColorInspector.m
< prev
next >
Wrap
Text File
|
1995-06-12
|
2KB
|
90 lines
// ColorInspector.m
// By Kevin Brain (ksbrain@zeus.UWaterloo.ca)
// Acts as an intermediary between the color inspector
// view controls (layed out in the file ColorInspector.nib)
// and the objects they inspect.
#import "ColorInspector.h"
#import "InspectMeApp.h"
#import "InspectorManager.h"
#import "Thing1.h"
#import <appkit/NXColorWell.h>
#import <appkit/Control.h> // displaying attributes
@implementation ColorInspector
static id theColorInspector = nil; // just one per class
// only a single instance of this class is permitted
// use [ColorInspector new] to return the single instance
+ new
{
if (!theColorInspector) {
theColorInspector = self = [super new];
if ([NXApp loadNibSection:"ColorInspector.nib" owner:self] == nil)
printf("Couldn't load ColorInspector.nib\n");
}
else
self = theColorInspector;
return self;
}
- setupInspectors:(id)mainInspector
{
inspectorManager = [NXApp inspectorManager];
bkgndColorInspectorNum = [inspectorManager
addInspector:(id)colorBox
title:(const char *)"Background Color Inspector"
atLocation:LOWERLEFTX :LOWERLEFTY
cached:YES cacheWindow:[colorBox window]];
return self;
}
- setCurrentParameterReceiver:(id)newCurrent
{
currentParameterReceiver = newCurrent;
return self;
}
- (unsigned int)bkgndColorInspectorNum
{
return bkgndColorInspectorNum;
}
- reflectbkgndColorAttributes:(id)theObject
{
if(!theObject) return self;
[graySliderOut setFloatValue:[theObject bkgndGray]];
[colorWellOut setColor:[theObject bkgndColor]];
return self;
}
/* Setting ingredient attribute values */
/* Targets of inspector controls */
/* NOTE: No range checking has been added to these methods yet. */
- inspSetGray:sender
{
[currentParameterReceiver setBkgndGray:[sender floatValue]];
[colorWellOut setColor:NXConvertGrayToColor([sender floatValue])];
return self;
}
- inspSetColor:sender
{
float aFloat;
[currentParameterReceiver setBkgndColor:[sender color]];
NXConvertColorToGray([sender color],&aFloat);
[graySliderOut setFloatValue:aFloat];
return self;
}
@end